package com.example.plugin_native.adapter

import android.view.View
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.example.plugin_native.R
import com.example.plugin_native.entity.PlotType
import com.support.base.BaseRcvAdapter

class FarmTypeRcvAdapter(mList: MutableList<PlotType>) :
    BaseRcvAdapter<PlotType>(mList) {

    override fun bindItemLayout(viewType: Int): Int = R.layout.item_bottom_farm_type

    override fun convert(itemView: View, data: PlotType, position: Int) {
        val textView = itemView.findViewById<TextView>(R.id.tv_farm_type)
        textView.text = data.plotTypeName
        if (data.isSelect) {
            textView.setBackgroundResource(R.drawable.bg_circle_green_light_color)
            textView.setTextColor(ContextCompat.getColor(textView.context, R.color.text_green))
        } else {
            textView.setBackgroundResource(R.drawable.bg_circle_gray_color)
            textView.setTextColor(ContextCompat.getColor(textView.context, R.color.text_gray))
        }
    }
}